CHARTS

Clean Energy

Lollipop Radial

Photo by Irfan Alijagic on Unsplash

Photo by Irfan Alijagic on Unsplash

Sunshine, lollipops and rainbows, everything that’s wonderful, Is sure to come your way…
— Lesley Gore


Ingest

energy types and country totals

  • Energy Type: limited to Level 1 or 2 production by type - either conventional thermal (fossil fuels), nuclear, hydro, wind, solar, geothermal, or other.
  • Country Totals: limited to total net production, along with imports, exports, energy lost, and energy supplied (net + import - export - energy absorbed by pumping).
energy_types <- read.csv("archetypes/clean-energy/energy-types.csv", header = TRUE, stringsAsFactors = FALSE)
energy_types
country_totals <- read.csv("archetypes/clean-energy/country-totals.csv", header = TRUE, stringsAsFactors = FALSE)
country_totals

Wrangle

filter, select, group by, calculate, and arrange …

df_wrangle <- 
  energy_types %>% 
  filter(level == "Level 1") %>% 
  select(country, country_name, type, amount = X2018) %>% 
  mutate(country_name = case_when(
    country == "EL" ~ "Greece",
    country == "UK" ~ "United Kingdom",
    TRUE ~ country_name
  )) %>% 
  group_by(country) %>% 
  mutate(total = sum(amount)) %>% 
  filter(type != "Conventional thermal") %>% 
  mutate(
    clean_total = sum(amount),
    percent_clean = clean_total/total,
    percent_type = amount/total,
    over50perc = ifelse(percent_clean > 0.5, "Over 50% clean energy", "NA")
  ) %>% 
  ungroup() %>% 
  arrange(country_name)

df_wrangle

Plot

radial lollipop

theme_opts <- theme(
  text = element_text(family = "inconsolata", size = 16), 
  plot.title = element_text(color = "black", size = 16, face = "bold"),
  plot.subtitle = element_text(color = "black", size = 12),
  plot.caption = element_text(color = "#555555", size = 11),
  plot.margin = margin(.25, 1, .25, .25, "in"),
  plot.background = element_blank(),
  axis.text.y = element_blank(),
  axis.text.x = element_text(hjust = -1, size = 7),
  panel.border = element_blank(),
  panel.background = element_blank(),
  panel.grid.minor.x = element_blank(),
  panel.grid.major.x = element_blank(),
  panel.grid.minor.y = element_blank(),
  # panel.grid.major.y = element_blank(),
  # axis.title.y = element_blank(),
  axis.ticks.y = element_blank(),
  axis.ticks.x = element_blank(),
  # axis.ticks.x = element_line(),
  # axis.ticks.length.x = unit(.35, "cm"),
  # axis.text.x=element_blank(),
  legend.position = "none"
  # legend.position = c(0.05, 0.925),
  # legend.margin = margin(0, 0, 0, 0),
  # legend.box.margin = margin(2, 8, 2, 2),
  # legend.background = element_blank(),
  # legend.box.background = element_rect(color = "grey65", fill = "#F0F0F0"),
  # legend.key = element_blank()
)

v1 <- df_wrangle %>% 
  ggplot(aes(reorder(country_name, -percent_clean), percent_clean)) +
  geom_hline(yintercept = 1, color = "grey70") +
  geom_hline(yintercept = 0, color = "grey70") +
  geom_segment(aes(x = reorder(country_name, -percent_clean), xend = reorder(country_name, -percent_clean), y = 0, yend = 1.1), color = "grey75", size = 0.5, lty = 3) +
  geom_segment(aes(x = reorder(country_name, -percent_clean), xend = reorder(country_name, -percent_clean), y = 0, yend = percent_clean), color = "grey40") +
  geom_point(aes(size = percent_clean, fill = over50perc), shape = 21, color = "grey40", alpha = 0.8) +
  scale_fill_manual(values = c("#f0f0f0", "grey40"), breaks = c("Over 50% clean energy"), labels = c("Over 50% clean"), name = NULL) +
  scale_size(range = c(1, 4)) +
  scale_y_continuous(limits = c(-0.15, 1.1)) +
  guides(size = "none") +
  coord_polar(clip = "off") +
  labs(
    title = "Clean energy in EU Countries 2018",
    subtitle = "Clean energy = Energy not produced by conventional thermal methods",
    x = NULL,
    y = NULL
  ) +
  theme_bw() +
  theme_opts

girafe(ggobj = v1, width_svg = 16, height_svg = 12,
       options = list(opts_sizing(rescale = TRUE, width = 0.9))
)

Plot

with polar labels

sequence_length = length(unique(df_wrangle$country_name))
first_sequence = c(1:(sequence_length%/%2)) 
second_sequence = c((sequence_length%/%2+1):sequence_length) 
first_angles = c(90 - 180/length(first_sequence) * first_sequence)
second_angles = c(-90 - 180/length(second_sequence) * second_sequence)

theme_opts_polar <- theme(
  text = element_text(family = "inconsolata", size = 16), 
    plot.title = element_text(color = "black", size = 16, face = "bold"),
    plot.subtitle = element_text(color = "black", size = 12),
    plot.caption = element_text(color = "#555555", size = 11),
    plot.margin = margin(.25, 1, .25, .25, "in"),
    plot.background = element_blank(),
    axis.text.y = element_blank(),
    axis.text.x = element_text( angle= c(first_angles, second_angles)),
    panel.border = element_blank(),
    panel.background = element_blank(),
    panel.grid.minor.x = element_blank(),
    panel.grid.major.x = element_blank(),
    panel.grid.minor.y = element_blank(),
    #panel.grid.major.y = element_blank(),
    # axis.title.y = element_blank(),
    axis.ticks.y = element_blank(),
    axis.ticks.x = element_blank(),
    # axis.ticks.x = element_line(),
    # axis.ticks.length.x = unit(.35, "cm"),
    # axis.text.x=element_blank(),
    legend.position = "none"
    #legend.position = c(0.05, 0.925),
    #legend.margin = margin(0, 0, 0, 0),
    #legend.box.margin = margin(2, 8, 2, 2),
    #legend.background = element_blank(),
    #legend.box.background = element_rect(color = "grey65", fill = "#F0F0F0"),
    #legend.key = element_blank()
)

v2 <- df_wrangle %>% 
  ggplot(aes(reorder(country_name, -percent_clean), percent_clean)) +
  geom_hline(yintercept = 1, color = "grey70") +
  geom_hline(yintercept = 0, color = "grey70") +
  geom_segment(aes(x = reorder(country_name, -percent_clean), xend = reorder(country_name, -percent_clean), y = 0, yend = 1.1), color = "grey75", size = 0.5, lty = 3) +
  geom_segment(aes(x = reorder(country_name, -percent_clean), xend = reorder(country_name, -percent_clean), y = 0, yend = percent_clean), color = "grey40") +
  geom_point(aes(size = percent_clean, fill = over50perc), shape = 21, color = "grey40", alpha = 0.8) +
  scale_fill_manual(values = c("#f0f0f0", "grey40"), breaks = c("Over 50% clean energy"), labels = c("Over 50% clean"), name = NULL) +
  scale_size(range = c(1, 4)) +
  scale_y_continuous(limits = c(-0.15, 1.1)) +
  guides(size = "none") +
  coord_polar(clip = "off") +
  labs(
    title = "Clean energy in EU Countries 2018",
    subtitle = "Clean energy = Energy not produced by conventional thermal methods",
    x = NULL,
    y = NULL
  ) +
  theme_bw() +
  theme_opts_polar

girafe(ggobj = v2, width_svg = 16, height_svg = 12,
       options = list(opts_sizing(rescale = TRUE, width = 0.9))
)

References

citations for narrative and data sources

  • Narrative and Data Source: Eurostat, GO